package com.yn.pet.controller.pc.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yn.system.domain.SysNotice;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
public class HelpCenterDetailResponse {
    @ApiModelProperty("公告ID")
    private Long noticeId;

    @ApiModelProperty("公告标题")
    private String noticeTitle;

    @ApiModelProperty("公告内容")
    private String noticeContent;

    @ApiModelProperty("公告类型")
    private Integer noticeType;

    @ApiModelProperty("公告类型名称")
    private String noticeTypeName;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("备注")
    private String remark;

    public static HelpCenterDetailResponse transform(SysNotice notice) {
        HelpCenterDetailResponse response = new HelpCenterDetailResponse();
        response.setNoticeId(notice.getNoticeId());
        response.setNoticeTitle(notice.getNoticeTitle());
        response.setNoticeContent(notice.getNoticeContent());
        response.setNoticeType(Integer.parseInt(notice.getNoticeType()));
        response.setCreateTime(notice.getCreateTime());
        response.setRemark(notice.getRemark());

        return response;
    }
}
